
<%--
  Created by IntelliJ IDEA.
  User: 熊自国
  Date: 2024/11/28
  Time: 8:58
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>

<head>
    <meta charset="UTF-8">
    <title>欢迎页面-L-admin1.0</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="shortcut icon" href="${pageContext.request.contextPath}/static/favicon.ico" type="image/x-icon" />
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/font.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/xadmin.css">
    <script src="${pageContext.request.contextPath}/static/js/jquery.min.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/js/xadmin.js"></script>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>

<body>
<div class="x-body">
    <form class="layui-form" action="${pageContext.request.contextPath}/pur/updatePurchase.do">
        <input type="hidden" name="purchaseId" value="${erpSupplyOrder.purchaseId}">
        <div class="layui-form-item">
            <label class="layui-form-label">
                <span class="x-red">*</span>供应商名称
            </label>
            <div class="layui-input-inline">
                <select  id="supplier"  name="supplierId">
                    <c:forEach var="pur" items="${erpSuppliers}">
                        <option value="${pur.supplierId}" ${pur.supplierId eq erpSupplyOrder.suppliersId?'selected=selected':''}>${pur.supplierName}</option>
                    </c:forEach>
                </select>
            </div>
        </div>

        <div class="layui-form-item">
            <label  class="layui-form-label">
                <span class="x-red">*</span>原料名称
            </label>
            <div class="layui-input-inline">
                <select   name="materialId">
                    <option>请选择原料</option>
                    <c:forEach var="pin" items="${materials}">
                        <option value="${pin.materialId}" ${pin.materialId eq erpSupplyOrder.materialId?'selected=selected':''}>${pin.materialName}</option>
                    </c:forEach>
                </select>
            </div>
        </div>
        <div class="layui-form-item">
            <label  class="layui-form-label">
                <span class="x-red">*</span>采购数量
            </label>
            <div class="layui-input-inline">
                <input type="text" id="number" name="quantity" required lay-verify="required"
                       autocomplete="off" class="layui-input" value="${erpSupplyOrder.purchaseQuantity}">
            </div>
        </div>
        <div class="layui-form-item">
            <label  class="layui-form-label">
                <span class="x-red">*</span>操作人
            </label>
            <div class="layui-input-inline">
                <select   name="userId">
                    <option>请选择用户</option>
                    <c:forEach var="pin" items="${user}">
                        <option value="${pin.userId}" ${pin.userId eq erpSupplyOrder.userId?'selected=selected':''}>${pin.userFullname}</option>
                    </c:forEach>
                </select>
            </div>
        </div>
<%--        <div class="layui-form-item layui-form-text">--%>
<%--            <label for="desc" class="layui-form-label">--%>
<%--                商品增加--%>
<%--            </label>--%>
<%--            <div class="layui-input-block">--%>
<%--                <table class="layui-table">--%>
<%--                    <tbody>--%>
<%--                    <tr>--%>
<%--                        <td>haier海尔 BC-93TMPF 93升单门冰箱</td>--%>
<%--                        <td>0.01</td>--%>
<%--                        <td>984</td>--%>
<%--                        <td>1</td>--%>
<%--                        <td>删除</td>--%>
<%--                    </tr>--%>
<%--                    <tr>--%>
<%--                        <td>haier海尔 BC-93TMPF 93升单门冰箱</td>--%>
<%--                        <td>0.01</td>--%>
<%--                        <td>984</td>--%>
<%--                        <td>1</td>--%>
<%--                        <td>删除</td>--%>
<%--                    </tr>--%>
<%--                    </tbody>--%>
<%--                </table>--%>
<%--            </div>--%>
<%--        </div>--%>
<%--        <div class="layui-form-item layui-form-text">--%>
<%--            <label for="desc" class="layui-form-label">--%>
<%--                取货地址--%>
<%--            </label>--%>
<%--            <div class="layui-input-block">--%>
<%--                <textarea placeholder="请输入内容" id="desc" name="purchaseAddress" class="layui-textarea"></textarea>--%>
<%--            </div>--%>
<%--        </div>--%>
        <div class="layui-form-item">
            <label for="L_repass" class="layui-form-label">
            </label>
            <button  class="layui-btn" lay-filter="add" lay-submit="" type="submit">
                增加
            </button>
        </div>
    </form>
</div>

<script>
<%--function gg(){--%>
<%--    alert(13)--%>
<%--    $.get("${pageContext.request.contextPath}/pur/findSupplier.do", function(data) {--%>
<%--        for (var i = 0; i < data.length; i++) {--%>
<%--            $("#gys").append("<option value=" + data[i].supplierName + ">" + data[i].supplierName + "</option>")--%>
<%--            $("#contactName").value(data.contactName)--%>
<%--        }--%>
<%--    })--%>
<%--}--%>

$("#supplier").change(function () {
    alert(123)
    var supplierName =$("#supplierName").val()
    $.get("${pageContext.request.contextPath}/pur/findName.do",{supplierName:supplierName}, function(data) {
        $("#contactName").val(data.contactName)
    })
})


    // layui.use(['form','layer'], function(){
    //     $ = layui.jquery;
    //     var form = layui.form
    //         ,layer = layui.layer;

        //自定义验证规则
        // form.verify({
        //     nikename: function(value){
        //         if(value.length < 5){
        //             return '昵称至少得5个字符啊';
        //         }
        //     }
        //     ,pass: [/(.+){6,12}$/, '密码必须6到12位']
        //     ,repass: function(value){
        //         if($('#L_pass').val()!=$('#L_repass').val()){
        //             return '两次密码不一致';
        //         }
        //     }
        // });
    //
    //     //监听提交
    //     form.on('submit(add)', function(data){
    //         console.log(data);
    //         //发异步，把数据提交给php
    //         layer.alert("增加成功", {icon: 6},function () {
    //             // 获得frame索引
    //             var index = parent.layer.getFrameIndex(window.name);
    //             //关闭当前frame
    //             parent.layer.close(index);
    //         });
    //         return false;
    //     });
    //
    //
    // });
</script>
</body>

</html>
